const path = require("path");
const CopyrightWebpackPlugin = require('./plugins/copyright-webpack-plugin.js');

module.exports = {
    mode: "development",
    entry: "./src/index.js",
    output: {
        path: path.resolve(__dirname, 'dist'),
        filename: '[name].js'
    },
    module: {
        rules: [{
            test: /\.js/,
            use: [
            {
                loader: path.resolve(__dirname, './src/loaders/loaderCreate.js'),
                options: {
                    name: "wangyanan"
                }
            },
            {
                loader: path.resolve(__dirname, './src/loaders/loaderCreatedAsync.js'),
                options: {
                    name: "wangyanan123"
                }
            }
        ]
        }]
    },
    resolveLoader:{
        modules:['node_modules','./src/loaders']
    },
    plugins:[
        new CopyrightWebpackPlugin()
    ]
}

// module.exports = {
//     resolveLoader: {
//         // 去哪些目录下寻找 Loader，有先后顺序之分
//         modules: ['node_modules', './loaders/'],
//     }
// }

// 加上以上配置后，Webpack会先去node_modules项目下寻找Loader，
// 如果找不到，会再去./loaders/目录下寻找